/**
 * Oct 27, 2011 9:31:46 AM
 * com.kratonsolution.cbs.security.dm
 * Security.java
 */
package com.kratonsolution.belian.security.api.dm;

import java.sql.Timestamp;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.Type;

import com.kratonsolution.belian.kernel.dm.IAuditable;
import com.kratonsolution.belian.kernel.dm.Model;

/**
 * @author Agung Dodi Perdana
 * @email agung.dodi.perdana@gmail.com
 * @Version Sinch 1.0
 */
@Entity
@Table(name="cbs_security_user")
@Cacheable
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class User extends Model implements IAuditable
{
    private static final long serialVersionUID = -5851059557322604384L;
        
    @Column(name="email")
    private String email;
    
    @Column(name="nick")
    private String nickName;
    
    @Column(name="password")
    private String password;
    
    @Column(name="last_login")
    private Timestamp lastLogin;
    
    @Column(name="is_blocked")
    @Type(type="yes_no")
    private boolean blocked;
    
    @Column(name="is_active")
    @Type(type="yes_no")
    @Fetch(FetchMode.JOIN)
    private boolean active;
    
    @Column(name="is_loged_in")
    @Type(type="yes_no")
    private boolean logedIn;
    
    @Column(name="view_configuration")
    private String viewConfiguration;
    
    public User(){}

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getNickName()
    {
        return nickName;
    }

    public void setNickName(String nickName)
    {
        this.nickName = nickName;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public Timestamp getLastLogin()
    {
        return lastLogin;
    }

    public void setLastLogin(Timestamp lastLogin)
    {
        this.lastLogin = lastLogin;
    }

    public boolean isBlocked()
    {
        return blocked;
    }

    public void setBlocked(boolean blocked)
    {
        this.blocked = blocked;
    }

    public boolean isActive()
    {
        return active;
    }

    public void setActive(boolean active)
    {
        this.active = active;
    }

    public boolean isLogedIn()
    {
        return logedIn;
    }

    public void setLogedIn(boolean logedIn)
    {
        this.logedIn = logedIn;
    }

    public String getViewConfiguration()
    {
        return viewConfiguration;
    }

    public void setViewConfiguration(String viewConfiguration)
    {
        this.viewConfiguration = viewConfiguration;
    }
}
